// 格式化时间的插件
import moment from "moment"

// 超过字数变成省略号
let slh = function (value, wordLimit) {
    // var str = $(textName).html()
    // console.log(str)
    // var subStr = str.substring(0, wordLimit)
    // // console.log(subStr)
    // $(textName).html(subStr + (str.length > wordLimit ? "..." : ""))
    let subStr = value.substring(0,wordLimit)
    let newSubStr = subStr + (value.length > wordLimit ? "..." : "")
    return newSubStr

};

// 格式化时间
let getTime = function (dataStr, pattern = "YYYY-MM-DD HH:mm:ss") {
    return moment(dataStr).format(pattern);
}


export default{
    slh,
    getTime,
}
